package jehc.djshi.oauth.command;

import jehc.djshi.oauth.service.OauthKeyInfoService;
import jehc.djshi.oauth.service.OauthSysModeService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
 * @Desc 初始化数据
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Component
@Order(0)
public class InitOauthData implements CommandLineRunner {

    @Resource
    OauthKeyInfoService oauthKeyInfoService;

    @Resource
    OauthSysModeService oauthSysModeService;

    /**
     *
     */
    private void init(){

        oauthKeyInfoService.sync();//初始化同步密钥缓存

        oauthSysModeService.sync();//初始化同步授权中心子系统缓存
    }

    @Override
    public void run(String... args) throws Exception {
        try {
            init();
        } catch (Exception e) {

        }
    }
}
